package dk.pun.aot.shared.character;

import java.io.Serializable;

import javax.jdo.annotations.EmbeddedOnly;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

@SuppressWarnings("serial")
@PersistenceCapable @EmbeddedOnly
public class CharacterSkills implements Serializable {
	
	// Fields
	@Persistent
	private int arts;
	@Persistent
	private int science;
	@Persistent
	private int technology;
	@Persistent
	private int commerce;
	@Persistent
	private int militaryTheory;
	@Persistent
	private int survival;
	@Persistent
	private int fineArts;
	@Persistent
	private int coercion;
	@Persistent
	private int alertness;
	@Persistent
	private int nefarious;
	@Persistent
	private int operateVehicle;
	@Persistent
	private int vehicleSystems;
	@Persistent
	private int coreFitness;
	@Persistent
	private int espionage;
	@Persistent
	private int meleeCombat;
	@Persistent
	private int smallArms;
	@Persistent
	private int assaultSupportWeapons;
	
	// Skills
	@Persistent
	private int history;
	@Persistent
	private int sociology;
	@Persistent
	private int theology;
	@Persistent
	private int law;

	@Persistent
	private int biology;
	@Persistent
	private int chemistry;
	@Persistent
	private int genetics;
	@Persistent
	private int medicine;
	@Persistent
	private int arcane;

	@Persistent
	private int electronics;
	@Persistent
	private int mechanicalTechnologies;
	@Persistent
	private int structuralTechnologies;
	@Persistent
	private int computerTechnologies;

	@Persistent
	private int barter;
	@Persistent
	private int production;
	@Persistent
	private int businessAdministration;
	@Persistent
	private int networking;
	
	@Persistent
	private int tactics;
	@Persistent
	private int leadership;
	
	@Persistent
	private int orienteering;
	@Persistent
	private int animalHandling;
	@Persistent
	private int livingOffTheLand;
	@Persistent
	private int tracking;
	
	@Persistent
	private int visualArts;
	@Persistent
	private int writing;
	@Persistent
	private int culinaryArts;
	@Persistent
	private int performing;

	@Persistent
	private int bluff;
	@Persistent
	private int intimidation;
	@Persistent
	private int negotiation;
	@Persistent
	private int manipulation;
	
	@Persistent
	private int senseAction;
	@Persistent
	private int readPeople;
	@Persistent
	private int concentration;
	@Persistent
	private int detection;

	@Persistent
	private int gatherInformation;
	@Persistent
	private int gamble;
	@Persistent
	private int sleightOfHand;
	@Persistent
	private int appraise;
	@Persistent
	private int streetSmarts;
	
	@Persistent
	private int groundVehicle;
	@Persistent
	private int aircraft;
	@Persistent
	private int watercraft;
	@Persistent
	private int powerSuits;
	@Persistent
	private int industrialVehocles;
	
	@Persistent
	private int navigationSystems;
	@Persistent
	private int weaponSystems;
	@Persistent
	private int sensoryAndCommunicationSystems;
	@Persistent
	private int equipmentSystems;

	@Persistent
	private int running;
	@Persistent
	private int swimming;
	@Persistent
	private int climbing;
	@Persistent
	private int throwing;
	@Persistent
	private int tumble;
	
	@Persistent
	private int theft;
	@Persistent
	private int stealth;
	@Persistent
	private int escapeArtist;
	@Persistent
	private int deceive;
	@Persistent
	private int defeatSecurity;
	
	@Persistent
	private int oneHandedMelee;
	@Persistent
	private int twoHandedMelee;
	@Persistent
	private int unarmedMelee;
	@Persistent
	private int grapple;
	
	@Persistent
	private int pistolsAndSMGs;
	@Persistent
	private int riflesAndShotguns;
	@Persistent
	private int bowsAndCrossbows;

	@Persistent
	private int heavyAssaultWeapons;
	@Persistent
	private int launchersAndMortars;
	@Persistent
	private int explosives;
	@Persistent
	private int mortars;

	public CharacterSkills() {
	}
	
	public void setFieldRank(FieldType fieldType, int fieldRank) {
		switch (fieldType) {
		case ARTS:
			this.arts = fieldRank;
			break;
		case SCIENCE:
			this.science = fieldRank;
			break;
		case TECHNOLOGY:
			this.technology = fieldRank;
			break;
		case COMMERCE:
			this.commerce = fieldRank;
			break;
		case MILITARY_THEORY:
			this.militaryTheory = fieldRank;
			break;
		case SURVIVAL:
			this.survival = fieldRank;
			break;
		case FINE_ARTS:
			this.fineArts = fieldRank;
			break;
		case COERCION:
			this.coercion = fieldRank;
			break;
		case ALERTNESS:
			this.alertness = fieldRank;
			break;
		case NEFARIOUS:
			this.nefarious = fieldRank;
			break;
		case OPERATE_VEHICLE:
			this.operateVehicle = fieldRank;
			break;
		case VEHICLE_SYSTEMS:
			this.vehicleSystems = fieldRank;
			break;
		case CORE_FITNESS:
			this.coreFitness = fieldRank;
			break;
		case ESPIONAGE:
			this.espionage = fieldRank;
			break;
		case MELEE_COMBAT:
			this.meleeCombat = fieldRank;
			break;
		case SMALL_ARMS:
			this.smallArms = fieldRank;
			break;
		case ASSAULT_SUPPORT_WEAPONS:
			this.assaultSupportWeapons = fieldRank;
			break;
		}
	}

	public int getFieldRank(FieldType fieldType) {
		int fieldRank = 0;
		switch (fieldType) {
		case ARTS:
			fieldRank = this.arts;
			break;
		case SCIENCE:
			fieldRank = this.science;
			break;
		case TECHNOLOGY:
			fieldRank = this.technology;
			break;
		case COMMERCE:
			fieldRank = this.commerce;
			break;
		case MILITARY_THEORY:
			fieldRank = this.militaryTheory;
			break;
		case SURVIVAL:
			fieldRank = this.survival;
			break;
		case FINE_ARTS:
			fieldRank = this.fineArts;
			break;
		case COERCION:
			fieldRank = this.coercion;
			break;
		case ALERTNESS:
			fieldRank = this.alertness;
			break;
		case NEFARIOUS:
			fieldRank = this.nefarious;
			break;
		case OPERATE_VEHICLE:
			fieldRank = this.operateVehicle;
			break;
		case VEHICLE_SYSTEMS:
			fieldRank = this.vehicleSystems;
			break;
		case CORE_FITNESS:
			fieldRank = this.coreFitness;
			break;
		case ESPIONAGE:
			fieldRank = this.espionage;
			break;
		case MELEE_COMBAT:
			fieldRank = this.meleeCombat;
			break;
		case SMALL_ARMS:
			fieldRank = this.smallArms;
			break;
		case ASSAULT_SUPPORT_WEAPONS:
			fieldRank = this.assaultSupportWeapons;
			break;
		}
		return fieldRank;
	}
	
	public void setSkillRank(SkillType skillType, int skillRank) {
		switch (skillType) {
		case HISTORY:
			this.history = skillRank;
			break;
		case SOCIOLOGY:
			this.sociology = skillRank;
			break;
		case THEOLOGY:
			this.theology = skillRank;
			break;
		case LAW:
			this.law = skillRank;
			break;
		case BIOLOGY:
			this.biology = skillRank;
			break;
		case CHEMISTRY:
			this.chemistry = skillRank;
			break;
		case GENETICS:
			this.genetics = skillRank;
			break;
		case MEDICINE:
			this.medicine = skillRank;
			break;
		case ARCANE:
			this.arcane = skillRank;
			break;
		case ELECTRONICS:
			this.electronics = skillRank;
			break;
		case MECHANICAL_TECHNOLOGIES:
			this.mechanicalTechnologies = skillRank;
			break;
		case STRUCTURAL_TECHNOLOGIES:
			this.structuralTechnologies = skillRank;
			break;
		case COMPUTER_TECHNOLOGIES:
			this.computerTechnologies = skillRank;
			break;
		case BARTER:
			this.barter = skillRank;
			break;
		case PRODUCTION:
			this.production = skillRank;
			break;
		case BUSINESS_ADMINISTRATION:
			this.businessAdministration = skillRank;
			break;
		case NETWORKING:
			this.networking = skillRank;
			break;
		case TACTICS:
			this.tactics = skillRank;
			break;
		case LEADERSHIP:
			this.leadership = skillRank;
			break;
		case ORIENTEERING:
			this.orienteering = skillRank;
			break;
		case ANIMAL_HANDLING:
			this.animalHandling = skillRank;
			break;
		case LIVING_OFF_THE_LAND:
			this.livingOffTheLand = skillRank;
			break;
		case TRACKING:
			this.tracking = skillRank;
			break;
		case VISUAL_ARTS:
			this.visualArts = skillRank;
			break;
		case WRITING:
			this.writing = skillRank;
			break;
		case CULINARY_ARTS:
			this.culinaryArts = skillRank;
			break;
		case PERFORMING:
			this.performing = skillRank;
			break;
		case BLUFF:
			this.bluff = skillRank;
			break;
		case INTIMIDATION:
			this.intimidation = skillRank;
			break;
		case NEGOTIATION:
			this.negotiation = skillRank;
			break;
		case MANIPULATION:
			this.manipulation = skillRank;
			break;
		case SENSE_ACTION:
			this.senseAction = skillRank;
			break;
		case READ_PEOPLE:
			this.readPeople = skillRank;
			break;
		case CONCENTRATION:
			this.concentration = skillRank;
			break;
		case DETECTION:
			this.detection = skillRank;
			break;
		case GATHER_INFORMATION:
			this.gatherInformation = skillRank;
			break;
		case GAMBLE:
			this.gamble = skillRank;
			break;
		case SLEIGHT_OF_HAND:
			this.sleightOfHand = skillRank;
			break;
		case APPRAISE:
			this.appraise = skillRank;
			break;
		case STREET_SMARTS:
			this.streetSmarts = skillRank;
			break;
		case GROUND_VEHICLE:
			this.groundVehicle = skillRank;
			break;
		case AIRCRAFT:
			this.aircraft = skillRank;
			break;
		case WATERCRAFT:
			this.watercraft = skillRank;
			break;
		case POWER_SUITS:
			this.powerSuits = skillRank;
			break;
		case INDUSTRIAL_VEHICLES:
			this.industrialVehocles = skillRank;
			break;
		case NAVIGATION_SYSTEMS:
			this.navigationSystems = skillRank;
			break;
		case WEAPON_SYSTEMS:
			this.weaponSystems = skillRank;
			break;
		case SENSORY_AND_COMMUNICATION_SYSTEMS:
			this.sensoryAndCommunicationSystems = skillRank;
			break;
		case EQUIPMENT_SYSTEMS:
			this.equipmentSystems = skillRank;
			break;
		case RUNNING:
			this.running = skillRank;
			break;
		case SWIMMING:
			this.swimming = skillRank;
			break;
		case CLIMBING:
			this.climbing = skillRank;
			break;
		case THROWING:
			this.throwing = skillRank;
			break;
		case TUMBLE:
			this.tumble = skillRank;
			break;
		case THEFT:
			this.theft = skillRank;
			break;
		case STEALTH:
			this.stealth = skillRank;
			break;
		case ESCAPE_ARTIST:
			this.escapeArtist = skillRank;
			break;
		case DECEIVE:
			this.deceive = skillRank;
			break;
		case DEFEAT_SECURITY:
			this.defeatSecurity = skillRank;
			break;
		case ONE_HANDED_MELEE:
			this.oneHandedMelee = skillRank;
			break;
		case TWO_HANDED_MELEE:
			this.twoHandedMelee = skillRank;
			break;
		case UNARMED_MELEE:
			this.unarmedMelee = skillRank;
			break;
		case GRAPPLE:
			this.grapple = skillRank;
			break;
		case PISTOLS_AND_SMGS:
			this.pistolsAndSMGs = skillRank;
			break;
		case RIFLES_AND_SHOTGUNS:
			this.riflesAndShotguns = skillRank;
			break;
		case BOWS_AND_CROSSBOWS:
			this.bowsAndCrossbows = skillRank;
			break;
		case HEAVY_ASSAULT_WEAPONS:
			this.heavyAssaultWeapons = skillRank;
			break;
		case LAUNCHERS_AND_MORTARS:
			this.launchersAndMortars = skillRank;
			break;
		case EXPLOSIVES:
			this.explosives = skillRank;
			break;
		case MORTARS:
			this.mortars = skillRank;
			break;
		}
	}

	public int getSkillRank(SkillType skillType) {
		int skillRank = 0;
		switch (skillType) {
		case HISTORY:
			skillRank = this.history;
			break;
		case SOCIOLOGY:
			skillRank = this.sociology;
			break;
		case THEOLOGY:
			skillRank = this.theology;
			break;
		case LAW:
			skillRank = this.law;
			break;
		case BIOLOGY:
			skillRank = this.biology;
			break;
		case CHEMISTRY:
			skillRank = this.chemistry;
			break;
		case GENETICS:
			skillRank = this.genetics;
			break;
		case MEDICINE:
			skillRank = this.medicine;
			break;
		case ARCANE:
			skillRank = this.arcane;
			break;
		case ELECTRONICS:
			skillRank = this.electronics;
			break;
		case MECHANICAL_TECHNOLOGIES:
			skillRank = this.mechanicalTechnologies;
			break;
		case STRUCTURAL_TECHNOLOGIES:
			skillRank = this.structuralTechnologies;
			break;
		case COMPUTER_TECHNOLOGIES:
			skillRank = this.computerTechnologies;
			break;
		case BARTER:
			skillRank = this.barter;
			break;
		case PRODUCTION:
			skillRank = this.production;
			break;
		case BUSINESS_ADMINISTRATION:
			skillRank = this.businessAdministration;
			break;
		case NETWORKING:
			skillRank = this.networking;
			break;
		case TACTICS:
			skillRank = this.tactics;
			break;
		case LEADERSHIP:
			skillRank = this.leadership;
			break;
		case ORIENTEERING:
			skillRank = this.orienteering;
			break;
		case ANIMAL_HANDLING:
			skillRank = this.animalHandling;
			break;
		case LIVING_OFF_THE_LAND:
			skillRank = this.livingOffTheLand;
			break;
		case TRACKING:
			skillRank = this.tracking;
			break;
		case VISUAL_ARTS:
			skillRank = this.visualArts;
			break;
		case WRITING:
			skillRank = this.writing;
			break;
		case CULINARY_ARTS:
			skillRank = this.culinaryArts;
			break;
		case PERFORMING:
			skillRank = this.performing;
			break;
		case BLUFF:
			skillRank = this.bluff;
			break;
		case INTIMIDATION:
			skillRank = this.intimidation;
			break;
		case NEGOTIATION:
			skillRank = this.negotiation;
			break;
		case MANIPULATION:
			skillRank = this.manipulation;
			break;
		case SENSE_ACTION:
			skillRank = this.senseAction;
			break;
		case READ_PEOPLE:
			skillRank = this.readPeople;
			break;
		case CONCENTRATION:
			skillRank = this.concentration;
			break;
		case DETECTION:
			skillRank = this.detection;
			break;
		case GATHER_INFORMATION:
			skillRank = this.gatherInformation;
			break;
		case GAMBLE:
			skillRank = this.gamble;
			break;
		case SLEIGHT_OF_HAND:
			skillRank = this.sleightOfHand;
			break;
		case APPRAISE:
			skillRank = this.appraise;
			break;
		case STREET_SMARTS:
			skillRank = this.streetSmarts;
			break;
		case GROUND_VEHICLE:
			skillRank = this.groundVehicle;
			break;
		case AIRCRAFT:
			skillRank = this.aircraft;
			break;
		case WATERCRAFT:
			skillRank = this.watercraft;
			break;
		case POWER_SUITS:
			skillRank = this.powerSuits;
			break;
		case INDUSTRIAL_VEHICLES:
			skillRank = this.industrialVehocles;
			break;
		case NAVIGATION_SYSTEMS:
			skillRank = this.navigationSystems;
			break;
		case WEAPON_SYSTEMS:
			skillRank = this.weaponSystems;
			break;
		case SENSORY_AND_COMMUNICATION_SYSTEMS:
			skillRank = this.sensoryAndCommunicationSystems;
			break;
		case EQUIPMENT_SYSTEMS:
			skillRank = this.equipmentSystems;
			break;
		case RUNNING:
			skillRank = this.running;
			break;
		case SWIMMING:
			skillRank = this.swimming;
			break;
		case CLIMBING:
			skillRank = this.climbing;
			break;
		case THROWING:
			skillRank = this.throwing;
			break;
		case TUMBLE:
			skillRank = this.tumble;
			break;
		case THEFT:
			skillRank = this.theft;
			break;
		case STEALTH:
			skillRank = this.stealth;
			break;
		case ESCAPE_ARTIST:
			skillRank = this.escapeArtist;
			break;
		case DECEIVE:
			skillRank = this.deceive;
			break;
		case DEFEAT_SECURITY:
			skillRank = this.defeatSecurity;
			break;
		case ONE_HANDED_MELEE:
			skillRank = this.oneHandedMelee;
			break;
		case TWO_HANDED_MELEE:
			skillRank = this.twoHandedMelee;
			break;
		case UNARMED_MELEE:
			skillRank = this.unarmedMelee;
			break;
		case GRAPPLE:
			skillRank = this.grapple;
			break;
		case PISTOLS_AND_SMGS:
			skillRank = this.pistolsAndSMGs;
			break;
		case RIFLES_AND_SHOTGUNS:
			skillRank = this.riflesAndShotguns;
			break;
		case BOWS_AND_CROSSBOWS:
			skillRank = this.bowsAndCrossbows;
			break;
		case HEAVY_ASSAULT_WEAPONS:
			skillRank = this.heavyAssaultWeapons;
			break;
		case LAUNCHERS_AND_MORTARS:
			skillRank = this.launchersAndMortars;
			break;
		case EXPLOSIVES:
			skillRank = this.explosives;
			break;
		case MORTARS:
			skillRank = this.mortars;
			break;
		}
		return skillRank;
	}
	
	public int getSkillProficiencyLevel(SkillType skillType) {
		return this.getSkillRank(skillType) + this.getFieldRank(skillType.getFieldType());
	}
}
